﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Alogient.Cameleon.Sdk;
using Alogient.Cameleon.Sdk.Items;

namespace Alogient.Cameleon.Sdk.tests
{
    [TestFixture]
    public class CMElementCollectionTest : FixtureBase
    {
        [SetUp]
        public void Init()
        {
        }

        [TearDown]
        public void Finish()
        {
        }

        protected CMElement LoadElement(int navID, string cultureCode, string name)
        {
            return new CMElement(navID, cultureCode, name);
        }

        protected CMElementCollection CreateCollection()
        {
            var elements = new CMElementCollection();
            var element = new CMElement(this.navID, frCultureCode, basicPartName);

            elements.Add(element);

            return elements;
        }

        [Test]
        public void SearchElement()
        {
            var elements = CreateCollection();
            var name = basicPartName;
            var element = elements[name];

            Assert.AreEqual(name, element.ElementName);
        }

        [Test]
        public void Exists()
        {
            var elements = CreateCollection();
            var name = basicPartName;

            Assert.IsTrue(elements.Exists(name));
        }

        [Test]
        public void Contains()
        {
            var elements = CreateCollection();
            var name = basicPartName;

            Assert.IsTrue(elements.Contains(name));
        }
    }
}
